/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.route.system.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author neco
 */
@Entity
@Table(name = "rps_station",  schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RpsStation.findAll", query = "SELECT r FROM RpsStation r"),
    @NamedQuery(name = "RpsStation.findByStationId", query = "SELECT r FROM RpsStation r WHERE r.stationId = :stationId"),
    @NamedQuery(name = "RpsStation.completeByStationName", query = "SELECT r FROM RpsStation r WHERE UPPER(r.stationName) LIKE :stationName"),
    @NamedQuery(name = "RpsStation.completeByStationNameAndWithoutId", query = "SELECT r FROM RpsStation r WHERE UPPER(r.stationName) LIKE :stationName AND r.stationId != :stationId"),
    @NamedQuery(name = "RpsStation.findByStationName", query = "SELECT r FROM RpsStation r WHERE r.stationName = :stationName")})
public class RpsStation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "station_id", nullable = false)
    private Integer stationId;
    @Size(max = 200)
    @Column(name = "station_name", length = 200)
    private String stationName;
    @OneToMany(mappedBy = "stationsStation")
    private List<RpsRouteStations> rpsRouteStationsList;
    @OneToMany(mappedBy = "descriptionFareChangingStation")
    private List<RpsRouteDescription> rpsRouteDescriptionList;

    public RpsStation() {
    }

    public RpsStation(Integer stationId) {
        this.stationId = stationId;
    }

    public Integer getStationId() {
        return stationId;
    }

    public void setStationId(Integer stationId) {
        this.stationId = stationId;
    }

    public String getStationName() {
        return stationName;
    }

    public void setStationName(String stationName) {
        this.stationName = stationName;
    }

    @XmlTransient
    public List<RpsRouteStations> getRpsRouteStationsList() {
        return rpsRouteStationsList;
    }

    public void setRpsRouteStationsList(List<RpsRouteStations> rpsRouteStationsList) {
        this.rpsRouteStationsList = rpsRouteStationsList;
    }

    @XmlTransient
    public List<RpsRouteDescription> getRpsRouteDescriptionList() {
        return rpsRouteDescriptionList;
    }

    public void setRpsRouteDescriptionList(List<RpsRouteDescription> rpsRouteDescriptionList) {
        this.rpsRouteDescriptionList = rpsRouteDescriptionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (stationId != null ? stationId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RpsStation)) {
            return false;
        }
        RpsStation other = (RpsStation) object;
        if ((this.stationId == null && other.stationId != null) || (this.stationId != null && !this.stationId.equals(other.stationId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.route.system.entity.RpsStation[ stationId=" + stationId + " ]";
    }
    
}
